<?php
/**
 * Created by PhpStorm.
 * User: Frings
 * Date: 2016/9/22
 * Time: 15:07
 */


use yii\helpers\Url;

?>
<script type="application/javascript">
    $(function ($) {
        <?php
        if($item != null){
        if($item['page_image_url'] != ''){
        ?>
        $("#page_image").show();
        <?php
        }
        }
        ?>
    });
</script>
<div>
    <form class="form-horizontal" id="modaledit_detail_form" method="post" enctype="multipart/form-data"
          action="card-tpl-save" target="upload_exec_target">

        <div class="form-group" style=" margin-top: 5px">
            <input type="hidden" id="id" name="id" class="form-control" value="<?= $item != null ? $item['id'] : '' ?>">
            <label class="control-label col-lg-2" class="control-label" for="exampleInputPassword2">卡片名称：</label>
            <div class="col-lg-10">
                <input type="text" id="name" name="name" class="form-control"
                       value="<?= $item != null ? $item['name'] : '' ?>">
            </div>
        </div>


        <div class="form-group" style=" margin-top: 5px">
            <label class="control-label col-lg-2" class="control-label" for="exampleInputPassword2">卡片描述：</label>
            <div class="col-lg-10">
            <textarea id="description" name="description" class="form-control"
                      rows="3"><?= $item != null ? $item['description'] : '' ?></textarea>
            </div>
        </div>
        <div class="form-group" style=" margin-top: 5px">
            <label class="control-label col-lg-2" class="control-label" for="exampleInputPassword2">价值积分：</label>
            <div class="col-lg-10">
                <div class="input-group m-bot15">
                    <input type="number" id="integral" name="integral" class="form-control"
                           value="<?= $item != null ? $item['integral'] : '' ?>">
                    <span class="input-group-btn">
                        <button class="btn btn-primary" type="button">筛选</button>
                    </span>
                </div>
            </div>
        </div>
        <div class="form-group" style=" margin-top: 2px">
            <label class="control-label col-lg-2" class="control-label" for="exampleInputPassword2">模板封面：</label>
            <div class="col-lg-10">
                <img id="page_image" name="page_image" src="<?= $item != null ? $item['page_image_url'] : '' ?>"
                     class="img-responsive" style="display: none;width:150px;"/>
            </div>
        </div>
        <div class="form-group" style=" margin-top: 5px;">
            <div class="col-lg-12">
                <input type="hidden" id="card_tpl_goods" name="card_tpl_goods">
                <table class="table table-bordered table-hover table-condensed" id="goods_table">
                    <thead class="nowrap">
                    <tr>
                        <th class="col-lg-1">排序(数字大的排前面)</th>
                        <th class="col-lg-2">产品编码</th>
                        <th class="col-lg-6">产品名</th>
                        <th class="col-lg-2">价格</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php
                    if ($goods != null && $goods != '') {
                        for ($i = 0; $i < count($goods); $i++) {
                            ?>
                            <tr>
                                <td><?= $goods[$i]['sort'] == null ? 0 : $goods[$i]['sort'] ?></td>
                                <td><?= $goods[$i]['code'] ?></td>
                                <td><?= $goods[$i]['name'] ?></td>
                                <td><?= $goods[$i]['selling_price'] ?></td>
                            </tr>
                            <?php
                        }
                    }
                    ?>
                    </tbody>
                </table>
            </div>
        </div>
    </form>
</div>
